import sys
from PySide6 import QtWidgets
from PySide6.QtWidgets import QApplication, QWidget
from WidgetElementsParams.ElbowCircleWidget import ElbowCircleWidget as ecw
import styles.styles_elements as styles

class ElbowWidget(QWidget):
    def __init__(self, parent=None):
        super(ElbowWidget, self).__init__(parent)

        self.elbow_circle = ecw()


        # Создание стэка виджетов
        self.stacked_widget = QtWidgets.QStackedWidget()
        self.stacked_widget.addWidget(self.elbow_circle)
        #self.stacked_widget.addWidget(self.rect_pipe)

        # Создание выпадающего списка типа сечений
        self.choose_type_cross_sec_cb = QtWidgets.QComboBox()

        self.choose_type_cross_sec_cb.setObjectName('cross_section')
        self.choose_type_cross_sec_cb.setStyleSheet(styles.QComboBox_StyleSheet)
        self.choose_type_cross_sec_cb.setPlaceholderText('Выбор сечения')
        self.choose_type_cross_sec_cb.addItems(('Круглое', ))

        # Отображение виджетов в окне
        self.vlayout = QtWidgets.QVBoxLayout()
        self.vlayout.addWidget(self.choose_type_cross_sec_cb)
        self.vlayout.addWidget(self.stacked_widget)
        self.setLayout(self.vlayout)

        self.choose_type_cross_sec_cb.currentIndexChanged.connect(self.stacked_widget.setCurrentIndex)

    def get_cross_section(self):
        return {self.choose_type_cross_sec_cb: self.choose_type_cross_sec_cb.currentText()}

    def get_params_element(self):
        params_elbow = self.elbow_circle.get_params_element()
        params_elbow.update(self.get_cross_section())
        return params_elbow

    def get_name_params_element(self):
        name_params_elbow = self.elbow_circle.get_name_params_element()
        return name_params_elbow


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = ElbowWidget()

    window.show()
    sys.exit(app.exec())